#pragma once
#include <iostream>
#include <ostream>
#include <string>

struct SingleDog
{
    static SingleDog *getInstance()
    {
        if (instance == nullptr)
        {
            instance = new SingleDog();
            return instance;
        }
        else
        {
            return instance;
        }
    }
    // TODO: for debug information
    friend std::ostream &operator<<(std::ostream &out, SingleDog &rhs);

private:
    std::string infoStr = "SingleDog Is A good type for helping people who want a signle object";
    static SingleDog *instance;
    SingleDog()
    {
        std::cout << "[DEBUG]: Init SingleDog Once" << std::endl;
    } // TODO: 一定要private
};

std::ostream &operator<<(std::ostream &out, SingleDog &rhs)
{
    out << rhs.infoStr.c_str() << std::endl;
    return out;
}
// 类的static 字段不能再类内初始化, 应该放到类外 Type ClassName::staticField = initvalue;
SingleDog *SingleDog::instance = nullptr;

// TODO: more single Object type to be added
// SingleMainRole(主角)